// source --> https://canbaby.ca/wp-content/plugins/wp-live-chat-support/js/themes/modern.js?ver=8.0.32 jQuery(document).on("bleeper_agent_disconnected", function(e) { var taid = jQuery(".wplc_agent_info").attr('aid'); if (taid == e.ndata.aid) { jQuery(".wplc_agent_info").html(""); wplc_animate_agent_header_down(); jQuery("#wplc_chatbox").css("top","18px"); } }); jQuery(document).on("bleeper_agent_left", function(e) { var taid = jQuery(".wplc_agent_info").attr('aid'); if (taid == e.ndata.agent) { jQuery(".wplc_agent_info").html(""); wplc_animate_agent_header_down(); jQuery("#wplc_chatbox").css("top","18px"); } }); jQuery(document).on("wplc_minimize_chat", function( e ) { wplc_is_chat_open = false; jQuery('#wp-live-chat').height(""); if(jQuery("#wp-live-chat").attr("original_pos") === "bottom_right"){ jQuery("#wp-live-chat").css("left", ""); jQuery("#wp-live-chat").css("bottom", "0"); jQuery("#wp-live-chat").css("right", "20px"); } else if(jQuery("#wp-live-chat").attr("original_pos") === "bottom_left"){ jQuery("#wp-live-chat").css("left", "20px"); jQuery("#wp-live-chat").css("bottom", "0"); jQuery("#wp-live-chat").css("right", ""); } else if(jQuery("#wp-live-chat").attr("original_pos") === "left"){ jQuery("#wp-live-chat").css("left", "20px"); jQuery("#wp-live-chat").css("bottom", "100px"); } else if(jQuery("#wp-live-chat").attr("original_pos") === "right"){ } jQuery('#wp-live-chat').addClass("wplc_close"); jQuery('#wp-live-chat').removeClass("wplc_open"); jQuery("#wp-live-chat").css("top", ""); jQuery("#wp-live-chat").css("height", ""); jQuery("#wp-live-chat-1").show(); jQuery("#wp-live-chat-1").css('cursor', 'pointer'); jQuery("#wp-live-chat-2").hide(); jQuery("#wp-live-chat-3").hide(); jQuery("#wp-live-chat-4").hide(); jQuery("#wplc_social_holder").hide(); jQuery("#nifty_ratings_holder").hide(); jQuery("#nifty_ratings_holder").hide(); jQuery("#wp-live-chat-react").hide(); jQuery("#wp-live-chat-minimize").hide(); jQuery("#wp-live-chat-header").show(); }); jQuery(document).on("wplc_start_chat", function( e ) { jQuery("#wp-live-chat-2-inner").hide("slow"); jQuery.event.trigger({type: "wplc_open_chat_1"}); jQuery.event.trigger({type: "wplc_open_chat_2", wplc_online: wplc_online}); }); jQuery(document).on( "wplc_open_chat_1", function( e ) { jQuery('#wp-live-chat').removeClass("wplc_close"); jQuery('#wp-live-chat').addClass("wplc_open"); jQuery("#wp-live-chat-react").hide(); Cookies.set('wplc_hide', "", { expires: 1, path: '/' }); jQuery("#wp-live-chat-minimize").show(); }); jQuery(document).on("wplc_agent_joined", function(e) { var temail = ''; var tname = ''; var taid = ''; var ta_tagline = ''; var ta_bio = ''; var ta_social_links = ''; if (typeof e.ndata.other.email !== "undefined") { temail = e.ndata.other.email; } if (typeof e.ndata.other.name !== "undefined") { tname = e.ndata.other.name; } if (typeof e.ndata.other.aid !== "undefined") { taid = parseInt(e.ndata.other.aid); } if (typeof e.ndata.other.agent_tagline !== "undefined") { ta_tagline = e.ndata.other.agent_tagline; } if (typeof e.ndata.other.agent_bio !== "undefined") { ta_bio = e.ndata.other.agent_bio; } if (typeof e.ndata.other.social_links !== "undefined") { ta_social_links = e.ndata.other.social_links; } //Ensure this agent ID is valid before proceeding if(!isNaN(taid)){ jQuery(".wplc_no_answer").remove(); jQuery(".admin_chat_name").html(tname); wplc_node_pair_name = tname; wplc_agent_name = tname; var timageurl = wplc_user_avatars[taid]; if(jQuery(".wplc_agent_info").html().trim() === "" || typeof jQuery(".wplc_agent_info").attr("aid") === "undefined"){ //No Agents have joined yet jQuery(".wplc_agent_info").html(''); jQuery(".wplc_agent_info").attr("aid",taid); if ( ! jQuery( '#agent_grav_'+taid ).length ) { jQuery('

', { 'class': '', 'style': 'text-align:center;', html: '
'+tname+''+ta_tagline+ta_bio+ta_social_links }).appendTo('.wplc_agent_info'); jQuery('', { 'class': 'bleeper_pullup down', html: '' }).appendTo('.wplc_agent_info'); } var csst = "url(https://www.gravatar.com/avatar/20a6e5c8b75ce87f4896f46ed6f49832?s=60&d=mm);"; jQuery("#wplc_chatbox_header_bg").css('background-image', 'url('+timageurl+'?s=380&d=mm)'); jQuery("#wplc_chatbox").css("top", jQuery("#wplc_chatbox_header").height()+18+"px" ); } else { var wplc_tracked_agents = jQuery(".wplc_agent_info").attr("aid"); var wplc_tracked_agents_object = wplc_tracked_agents.split(","); var wplc_tracked_agent_match = false; //No duplicates found yet for(var i in wplc_tracked_agents_object){ var wplc_indexed_agent_id = parseInt(wplc_tracked_agents_object[i]); if(wplc_indexed_agent_id === taid){ //Match - This agent is already being tracked wplc_tracked_agent_match = true; } } if(!wplc_tracked_agent_match) { //Agent is not being tracked yet wplc_tracked_agents += "," + taid; jQuery(".wplc_agent_info").attr("aid", wplc_tracked_agents); //Update Names var wplc_current_agent_names = jQuery(".wplc_agent_name").text(); jQuery(".wplc_agent_name").text(wplc_current_agent_names + ", " + tname); //Hide the tagline, it is not needed for two agents in my opinion - Dylan Auty jQuery(".wplc_agent_tagline").hide(); //Hide social links, it is too cluttered to add more here jQuery(".wplc_agent_social_links").hide(); //Change the way the images are displayed jQuery("img.wplc_agent_involved").removeClass("wplc_thumb32").addClass("wplc_thumb16_stacked"); //Add the new agents image as well var wplc_new_agent_grav = ''; jQuery(wplc_new_agent_grav).insertAfter("img.wplc_agent_involved:last"); //Update the height of the header jQuery("#wplc_chatbox_header").css("max-height", jQuery("#wplc_chatbox_header").outerHeight()); jQuery("#wplc_chatbox").css("top", jQuery("#wplc_chatbox_header").height()+"px"); //Final update incase anything has changes jQuery("#wplc_chatbox_header_bg").css("background-image", "none"); } } } }); jQuery(document).on("bleeper_build_involved_agents_header", function(e){ if(typeof e.ndata !== "undefined"){ if(typeof e.ndata.chatid !== "undefined" && typeof e.ndata.agents !== "undefined"){ if(e.ndata.chatid === chatid){ var agent_match = e.ndata.agents; for(var i in agent_match){ var current_agent = agent_match[i]; if(typeof wplc_agent_data[current_agent] !== "undefined"){ wplc_agent_data[current_agent].md5; wplc_agent_data[current_agent].name; var other = { email: wplc_agent_data[current_agent].md5, name: wplc_agent_data[current_agent].name, aid: current_agent }; jQuery.event.trigger({type: "wplc_agent_joined", ndata: {other: other}}); } } } } } }); jQuery(document).on("wplc_animation_done", function(e) { jQuery("#nifty_text_editor_holder").remove(); jQuery("#wplc_msg_notice").remove(); jQuery("#wp-live-chat-minimize").remove(); jQuery("#wplc_logo").prependTo("#wplc_chatbox_header"); if (jQuery("wplc_chatbox").hasClass("wplc-shrink")) { /** * The +18px is to compensate for the 18px of padding at the bottom of the header box */ jQuery("#wplc_chatbox").css("top", jQuery("#wplc_chatbox_header").height()+18+"px" ); jQuery("#wplc_logo").show(); } else { /** * The +18px is to compensate for the 18px of padding at the bottom of the header box */ jQuery("#wplc_chatbox").css("top", jQuery("#wplc_chatbox_header").height()+18+"px" ); jQuery("#wplc_logo").hide(); } jQuery("#wplc_chatbox").css("bottom", "0"); }); jQuery(document).on( "wplc_open_chat_2", function( e ) { wplc_chat_status = Cookies.get('wplc_chat_status'); if (Cookies.get('wplc_minimize') === 'yes' && !jQuery("#wp-live-chat-header").hasClass("active")) { } else { jQuery("#wp-live-chat-1").hide(); jQuery("#wp-live-chat-2-inner").hide(); jQuery("#wp-live-chat-2").show(); if(!jQuery("#wp-live-chat-header").hasClass("active")){ jQuery("#wplc_chatmsg").focus(); } jQuery("#wp-live-chat-header").addClass("active"); jQuery("#wp-live-chat").addClass("mobile-active"); wplc_chat_status = Cookies.get('wplc_chat_status'); if (typeof e.wplc_online !== "undefined" && e.wplc_online === true) { jQuery("#wp-live-chat-4").show(); jQuery("#wplc_social_holder").show(); jQuery("#nifty_ratings_holder").show(); jQuery.event.trigger({type: "wplc_animation_done"}); } setTimeout(function() { wplc_scroll_to_bottom(); },1000); jQuery("#wp-live-chat-3").hide(); jQuery("#wplc_chatmsg").focus(); jQuery("#wp-live-chat-minimize").css("right","23px"); Cookies.set('wplc_minimize', "", { expires: 1, path: '/' }); } }); var wplc_leave_window_alone = false; var wplc_currently_animating_agent_header = false; jQuery(function() { jQuery("body").on("mousewheel", "#wplc_chatbox", function(turn, delta){ if (delta == 1) { /** * The +18px is to compensate for the 18px of padding at the bottom of the header box */ wplc_animate_agent_header_up(); } else { // going down /** * The +18px is to compensate for the 18px of padding at the bottom of the header box */ wplc_animate_agent_header_down(); } }); jQuery("body").on("click", ".bleeper_pullup", function() { if (jQuery(".bleeper_pullup").hasClass('down')) { wplc_animate_agent_header_down(); } else { wplc_animate_agent_header_up(); } }); //opens chat when clicked on top bar jQuery("body").on("click", "#wp-live-chat-header", function() { }); jQuery("body").on("click", ".wplc_retry_chat", function() { jQuery("#wplc_chatbox").html(""); jQuery("#wp-live-chat-4").fadeOut(); Cookies.remove('wplc_chat_status'); jQuery("#wp-live-chat-2-inner").fadeIn(); wplc_shown_welcome = false; }); jQuery("body").on("click", "#wp-live-chat-header", function(){ if (jQuery(this).hasClass('active')) { jQuery("#wplc_hovercard").fadeOut("fast"); jQuery("#wp-live-chat-2").fadeOut("fast"); jQuery(this).removeClass('active'); jQuery.event.trigger({type: "wplc_minimize_chat"}); Cookies.set('wplc_minimize', "yes", { expires: 1, path: '/' }); } else { jQuery("#wplc_hovercard").fadeIn('fast'); jQuery(this).addClass('active'); wplc_chat_status = Cookies.get('wplc_chat_status'); nc_status = Cookies.get('nc_status'); if (parseInt(wplc_chat_status) == 3 || parseInt(wplc_chat_status) == 2 || parseInt(wplc_chat_status) == 0 || parseInt(wplc_chat_status) == 12 || parseInt(wplc_chat_status) == 10 || nc_status === 'active') { jQuery("#bleeper_bell").hide(); jQuery("#speeching_button").click(); } } jQuery('#wplc_gdpr_end_chat_notice_container').hide(); }); jQuery("body").on("click", "#wplc_hovercard_min", function() { jQuery("#wplc_hovercard").fadeOut('fast'); }); jQuery("body").on("click", "#speeching_button", function() { jQuery("#wplc_hovercard").fadeOut("fast"); jQuery("#wplc-chat-alert").removeClass('is-active'); wplc_is_chat_open = true; jQuery.event.trigger({type: "wplc_open_chat"}); }); jQuery("body").on("click", "#wp-live-chat-minimize", function() { jQuery("#wp-live-chat-header").removeClass('active'); }); }); function wplc_animate_agent_header_up() { if(!wplc_currently_animating_agent_header && jQuery("#wplc_chatbox_header").hasClass("wplc-shrink") && jQuery('#wplc_chatbox_header .wplc_agent_info:first-child').html() !== ""){ wplc_currently_animating_agent_header = true; jQuery("#wplc_chatbox_header").removeClass("wplc-shrink"); jQuery("#wplc_chatbox_header").animate( { maxHeight: "280px", }, { duration: 700, complete: function() { // Animation complete jQuery("#wplc_logo").show(); wplc_currently_animating_agent_header = false; jQuery("#wplc_chatbox_header").css("max-height", jQuery("#wplc_chatbox_header").outerHeight()); jQuery("#wplc_chatbox").css("top", jQuery("#wplc_chatbox_header").height()+18+"px"); //Final update incase anything has changes }, progress: function() { jQuery("#wplc_chatbox").css("top", jQuery("#wplc_chatbox_header").height()+18+"px"); //Live movement updates } } ); } jQuery(".bleeper_pullup").removeClass('up'); jQuery(".bleeper_pullup").addClass('down'); jQuery(".bleeper_pullup").html(""); jQuery(".bleeper_pullup").css('bottom','5px'); } function wplc_animate_agent_header_down() { if(!wplc_currently_animating_agent_header && !jQuery("#wplc_chatbox_header").hasClass("wplc-shrink") && jQuery('#wplc_chatbox_header .wplc_agent_info:first-child').html() !== ""){ wplc_currently_animating_agent_header = true; jQuery("#wplc_chatbox_header").addClass("wplc-shrink"); jQuery("#wplc_chatbox").css("top", "50px"); jQuery("#wplc_chatbox_header").animate( { height: "50px", maxHeight: "50px"}, { duration: 200, start: function(){ jQuery("#wplc_logo").hide(); }, complete: function() { // Animation complete wplc_currently_animating_agent_header = false; jQuery("#wplc_chatbox_header").css("max-height", "50px"); jQuery("#wplc_chatbox_header").css("height", "auto"); } } ); } jQuery(".bleeper_pullup").removeClass('down'); jQuery(".bleeper_pullup").addClass('up'); jQuery(".bleeper_pullup").html(""); jQuery(".bleeper_pullup").css('bottom','0px'); } !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a:a(jQuery)}(function(a){function b(b){var g=b||window.event,h=i.call(arguments,1),j=0,l=0,m=0,n=0,o=0,p=0;if(b=a.event.fix(g),b.type="mousewheel","detail"in g&&(m=-1*g.detail),"wheelDelta"in g&&(m=g.wheelDelta),"wheelDeltaY"in g&&(m=g.wheelDeltaY),"wheelDeltaX"in g&&(l=-1*g.wheelDeltaX),"axis"in g&&g.axis===g.HORIZONTAL_AXIS&&(l=-1*m,m=0),j=0===m?l:m,"deltaY"in g&&(m=-1*g.deltaY,j=m),"deltaX"in g&&(l=g.deltaX,0===m&&(j=-1*l)),0!==m||0!==l){if(1===g.deltaMode){var q=a.data(this,"mousewheel-line-height");j*=q,m*=q,l*=q}else if(2===g.deltaMode){var r=a.data(this,"mousewheel-page-height");j*=r,m*=r,l*=r}if(n=Math.max(Math.abs(m),Math.abs(l)),(!f||f>n)&&(f=n,d(g,n)&&(f/=40)),d(g,n)&&(j/=40,l/=40,m/=40),j=Math[j>=1?"floor":"ceil"](j/f),l=Math[l>=1?"floor":"ceil"](l/f),m=Math[m>=1?"floor":"ceil"](m/f),k.settings.normalizeOffset&&this.getBoundingClientRect){var s=this.getBoundingClientRect();o=b.clientX-s.left,p=b.clientY-s.top}return b.deltaX=l,b.deltaY=m,b.deltaFactor=f,b.offsetX=o,b.offsetY=p,b.deltaMode=0,h.unshift(b,j,l,m),e&&clearTimeout(e),e=setTimeout(c,200),(a.event.dispatch||a.event.handle).apply(this,h)}}function c(){f=null}function d(a,b){return k.settings.adjustOldDeltas&&"mousewheel"===a.type&&b%120===0}var e,f,g=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],h="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],i=Array.prototype.slice;if(a.event.fixHooks)for(var j=g.length;j;)a.event.fixHooks[g[--j]]=a.event.mouseHooks;var k=a.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var c=h.length;c;)this.addEventListener(h[--c],b,!1);else this.onmousewheel=b;a.data(this,"mousewheel-line-height",k.getLineHeight(this)),a.data(this,"mousewheel-page-height",k.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var c=h.length;c;)this.removeEventListener(h[--c],b,!1);else this.onmousewheel=null;a.removeData(this,"mousewheel-line-height"),a.removeData(this,"mousewheel-page-height")},getLineHeight:function(b){var c=a(b),d=c["offsetParent"in a.fn?"offsetParent":"parent"]();return d.length||(d=a("body")),parseInt(d.css("fontSize"),10)||parseInt(c.css("fontSize"),10)||16},getPageHeight:function(b){return a(b).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})}); // source --> https://canbaby.ca/wp-content/plugins/wp-live-chat-support/js/bleeper_action_events.js?ver=8.0.32 function wplc_emit_custom_data_event( action, event_object ){ if (typeof socket !== "undefined" && socket.connected === true) { var a_wplc_cid = Cookies.get('wplc_cid'); if( typeof a_wplc_cid !== 'undefined' ) { socket.emit('custom data',{ action: action, chatid: a_wplc_cid, ndata: event_object } ); } } } var scrolling = false; jQuery(document).scroll(function() { if( !scrolling ){ scrolling = true; } clearTimeout(jQuery.data(this, 'scrollTimer')); jQuery.data(this, 'scrollTimer', setTimeout(function() { // do something wplc_emit_custom_data_event( 'user_scrolling', { scrolling: true } ); scrolling = false; }, 250)); }); jQuery(function(){ jQuery("input, textarea").on("focus", function(){ var input_field_id = jQuery(this).attr('id'); var input_field_class = jQuery(this).attr('class'); var input_field_value = jQuery(this).val(); var input_field_obj = { id: input_field_id, class: input_field_class, content: input_field_value, fields: true } wplc_emit_custom_data_event( 'input_field_change', input_field_obj ); }); }); jQuery(document).on("click", function(e) { if ( (jQuery(e.target).closest('a').length) || (jQuery(e.target).closest('input').length) || (jQuery(e.target).closest('select').length) || (jQuery(e.target).closest('textarea').length) ) { return; /* handled elsewhere */ } else { var parent1 = jQuery(e.target).parent().attr('id'); var parent2 = jQuery(e.target).parent().parent().attr('id'); var parent3 = jQuery(e.target).parent().parent().parent().attr('id'); var parent4 = jQuery(e.target).parent().parent().parent().parent().attr('id'); var parent5 = jQuery(e.target).parent().parent().parent().parent().parent().attr('id'); var parent6 = jQuery(e.target).parent().parent().parent().parent().parent().parent().attr('id'); var parent7 = jQuery(e.target).parent().parent().parent().parent().parent().parent().parent().attr('id'); var parent8 = jQuery(e.target).parent().parent().parent().parent().parent().parent().parent().parent().attr('id'); var parent9 = jQuery(e.target).parent().parent().parent().parent().parent().parent().parent().parent().parent().attr('id'); var parent10 = jQuery(e.target).parent().parent().parent().parent().parent().parent().parent().parent().parent().parent().attr('id'); if (parent1 !== "wp-live-chat" && parent2 !== "wp-live-chat" && parent3 !== "wp-live-chat" && parent4 !== "wp-live-chat" && parent5 !== "wp-live-chat" && parent6 !== "wp-live-chat" && parent7 !== "wp-live-chat" && parent8 !== "wp-live-chat" && parent9 !== "wp-live-chat" && parent10 !== "wp-live-chat") { //html2canvas(e.target).then(function(canvas) { //wplc_emit_custom_data_event( 'send_user_canvas', canvas.toDataURL("image/png")); //}); var elem_id = jQuery(e.target).attr('id'); var elem_class = jQuery(e.target).attr('class'); var event_data = { elem_id: elem_id, elem_class: elem_class } wplc_emit_custom_data_event( 'send_user_click_data', event_data ); } } }); var timeout = null; jQuery(document).on('mousemove', function() { clearTimeout(timeout); timeout = setTimeout(function() { wplc_emit_custom_data_event( 'send_user_mouse_idling', { idle: true } ); }, 300000); }); jQuery(document).mousedown(function(ev){ if(ev.which == 3){ wplc_emit_custom_data_event( 'send_user_right_clicked', { right_clicked: true } ); } }); jQuery(document).on("click", "a", function() { //this == the link that was clicked var href = jQuery(this).attr("href"); var text = jQuery(this).html(); wplc_emit_custom_data_event( 'send_link_click', { link_click: true, text: text } ); }); window.onkeydown = function(e){ if(e.keyCode == 70 && e.ctrlKey){ wplc_emit_custom_data_event( 'send_user_ctrl_f', { ctrl_f: true } ); } if(e.keyCode == 80 && e.ctrlKey){ wplc_emit_custom_data_event( 'send_user_ctrl_p', { ctrl_p: true } ); } if(e.keyCode == 67 && e.ctrlKey){ wplc_emit_custom_data_event( 'send_user_ctrl_c', { ctrl_c: true } ); } if(e.keyCode == 86 && e.ctrlKey){ wplc_emit_custom_data_event( 'send_user_ctrl_v', { ctrl_v: true } ); } if(e.keyCode == 44){ // Multiple ways to go about this due to different OS's // wplc_emit_custom_data_event( { ctrl_: true } ); } if( ( e.ctrlKey && e.keyCode == 16 && ( e.keyCode == 74 || e.keyCode == 73 ) ) || e.keyCode == 123 ){ wplc_emit_custom_data_event( 'send_user_console_opened', { console_log_opened: true } ); } if ( e.ctrlKey && e.shiftKey && e.keyCode === 74) { wplc_emit_custom_data_event( 'send_user_console_opened', { console_log_opened: true } ); } }; // source --> https://canbaby.ca/wp-content/plugins/wp-live-chat-support/js/wplc_pro_features.js?ver=5.2.20 var wplc_searchTimeout; var wplc_is_typing = false; var wplc_has_sent_auto_first_response = false; jQuery(document).on("wplc_animation_done", function(e) { jQuery('.nifty_rating_icon').click(function(evt){ jQuery('.nifty_rating_icon').removeClass('wplc-color-1'); jQuery(this).addClass('wplc-color-1'); }); jQuery("#nifty_rating_pos").click(function(evt){ jQuery("#nifty_rating_thanks").hide(); jQuery("#nifty_ratings_form").fadeIn(); jQuery("#nifty_rating_button").attr("nifty-rating", "1"); evt.stopImmediatePropagation(); }); jQuery("#nifty_rating_neg").click(function(evt){ jQuery("#nifty_rating_thanks").hide(); jQuery("#nifty_ratings_form").fadeIn(); jQuery("#nifty_rating_button").attr("nifty-rating", "0"); evt.stopImmediatePropagation(); }); jQuery("#nifty_rating_button").click(function(evt){ var nifty_rating = jQuery(this).attr("nifty-rating"); var nifty_comment = jQuery("#nifty_ratings_comment").val() !== "" ? jQuery("#nifty_ratings_comment").val() : "No Comment..."; jQuery("#nifty_ratings_form").hide(); jQuery("#nifty_recording").fadeIn(); var formData = new FormData(); formData.append('action', 'wplc_record_chat_rating'); formData.append('cid', Cookies.get('wplc_cid')); formData.append('rating', nifty_rating); formData.append('comment', nifty_comment); formData.append('security', wplc_nonce ); formData.append('update_chat_rating', "1" ); formData.append('wplc_extra_data[domain]', wplc_extra_data['domain'] ); formData.append('wplc_extra_data[api_key]', wplc_extra_data['api_key'] ); jQuery.ajax({ url : wplc_ajaxurl, type : 'POST', data : formData, cache: false, processData: false, contentType: false, success : function(data) { wplc_pro_rating_show_thanks_message(); }, error : function (){ wplc_pro_rating_show_thanks_message(); } }); jQuery.event.trigger({type: 'wplc_send_live_rating', rating: {score: nifty_rating, comment: nifty_comment} }); evt.stopImmediatePropagation(); }); function wplc_pro_rating_show_thanks_message(){ jQuery("#nifty_recording").fadeOut(); jQuery("#nifty_rating_thanks").fadeIn(); setTimeout(function(){ jQuery("#nifty_rating_thanks").fadeOut(); }, 2000); } }); jQuery(function() { jQuery(document).on("wplc_start_chat", function( e ) { var data = { action: 'wplc_start_chat_hook', security: wplc_nonce, cid: Cookies.get('wplc_cid'), wplc_extra_data:{ name: jQuery("#wplc_name").val(), email: jQuery("#wplc_email").val(), } }; if (typeof wplc_restapi_enabled !== "undefined" && wplc_restapi_enabled === '1') { data.security = (typeof wplc_restapi_token !== "undefined" ? wplc_restapi_token : false); jQuery.post(wplc_restapi_endpoint+"/new-chat/", data, function(response) {}); } }); jQuery("body").on("change", "#wplc_user_selected_department", function(){ if(wplc_extra_data !== "undefined"){ wplc_extra_data['wplc_user_selected_department'] = jQuery(this).val(); } }); }); jQuery(document).on("bleeper_send_message", function(e) { if(typeof wplc_pro_auto_resp_chat_msg !== 'undefined' && wplc_pro_auto_resp_chat_msg !== ""){ if(wplc_has_sent_auto_first_response == false){ if(jQuery('.wplc-admin-message').length <= 0){ var first_response_html = ""; first_response_html += "

"; first_response_html += "" + wplc_pro_auto_resp_chat_msg + ""; first_response_html += "
"; setTimeout(function(){ jQuery('#wplc_chatbox').append(first_response_html); }, 1000); } wplc_has_sent_auto_first_response = true; } } }); function wplc_start_chat_pro_data(data){ if(typeof wplc_extra_data !== "undefined" && typeof wplc_extra_data['wplc_user_selected_department'] !== "undefined"){ data['wplc_user_selected_department'] = wplc_extra_data['wplc_user_selected_department']; } return data; } /* Handles Uploading and sharing a file within chat*/ function wplcShareFile(fileToUpload, failedID, successID, uploadingID, originalID){ var formData = new FormData(); formData.append('action', 'wplc_upload_file'); formData.append('cid', Cookies.get('wplc_cid')); formData.append('file', fileToUpload); formData.append('timestamp', Date.now()); formData.append('security', wplc_nonce ); /*Handle jQuery Elements*/ jQuery(uploadingID).show(); jQuery(originalID).hide(); jQuery(successID).hide(); jQuery(failedID).hide(); if(fileToUpload.name.indexOf(".php") === -1 && fileToUpload.name.indexOf(".html") === -1 && fileToUpload.name.indexOf(".js") === -1 && fileToUpload.name.indexOf(".asp") === -1 && fileToUpload.name.indexOf(".svg") === -1){ //Files allowed - continue if(fileToUpload.size < 4000000){ //Max size of 4MB jQuery.ajax({ url : wplc_ajaxurl_site, type : 'POST', data : formData, cache: false, processData: false, contentType: false, success : function(data) { if(parseInt(data) !== 0){ jQuery(uploadingID).hide(); jQuery(successID).show(); setTimeout(function(){ jQuery(successID).hide(); jQuery(originalID).show(); }, 2000); //All good post the link to file var tag = (data.indexOf(".png") !== -1 || data.indexOf(".PNG") !== -1 ||data.indexOf(".jpg") !== -1 || data.indexOf(".JPG") !== -1 || data.indexOf(".jpeg") !== -1 || data.indexOf(".gif") !== -1 || data.indexOf(".bmp")!== -1 ) ? "img" : "link"; if(tag !== "img"){ tag = (data.indexOf(".mp4") !== -1 || data.indexOf(".mpeg4") !== -1 || data.indexOf(".webm") !== -1 || data.indexOf(".oog") !== -1 ) ? "video" : "link"; //video now } jQuery("#wplc_chatmsg").val(tag + ":" + data + ":" + tag); //Add to input field jQuery("#wplc_send_msg").trigger("click"); //Send message } else{ jQuery(uploadingID).hide(); jQuery(failedID).show(); setTimeout(function(){ jQuery(failedID).hide(); jQuery(originalID).show(); }, 2000); } }, error : function (){ jQuery(uploadingID).hide(); jQuery(failedID).show(); setTimeout(function(){ jQuery(failedID).hide(); jQuery(originalID).show(); }, 2000); } }); }else{ alert("File limit is 4mb"); jQuery(uploadingID).hide(); jQuery(failedID).show(); setTimeout(function(){ jQuery(failedID).hide(); jQuery(originalID).show(); }, 2000); } } else{ alert("File type not supported"); jQuery(uploadingID).hide(); jQuery(failedID).show(); setTimeout(function(){ jQuery(failedID).hide(); jQuery(originalID).show(); }, 2000); } } function wplc_start_chat_pro_custom_fields_filter( wplc_extra_data_tmp, rest_action_data, callback ) { var custom_field_array = {}; var cnt = 0; jQuery('*[name^="wplc_custom_field"]').each(function(key, val) { var field_name = jQuery(this).attr( "fname" ); custom_field_array[cnt] = {}; custom_field_array[cnt][0] = field_name; custom_field_array[cnt][1] = jQuery(this).val(); cnt++; }); var custom_data = custom_field_array; wplc_extra_data_tmp['custom_fields'] = JSON.stringify(custom_data); if(typeof callback === "function"){ rest_action_data.wplc_extra_data = wplc_extra_data_tmp; callback(wplc_extra_data_tmp, rest_action_data); } return wplc_extra_data_tmp; }; // source --> https://canbaby.ca/wp-content/plugins/wp-live-chat-support/js/wplc_u_node_pro_events.js?ver=8.0.32 jQuery(function () { /** * Handle the 'typing' event * * PRO ONLY function * * @return void */ jQuery(document).on("bleeper_typing", function(e) { /* TO DO */ jQuery(".typing_indicator").html(""+e.ndata.username+ " "+wplc_localized_string_is_typing_single + ""); jQuery(".typing_indicator").addClass("typing_indicator_active"); }); /** * Agent has stopped typing. * * * @return void */ jQuery(document).on("bleeper_stop_typing", function(e) { /* TO DO */ jQuery("#wplc_user_typing").fadeOut("slow").remove(); jQuery(".typing_indicator").removeClass("typing_indicator_active") }); /** * The agent has initiated a chat with us, open the chat box. * * @return void */ jQuery(document).on("bleeper_agent_initiated_chat", function(e) { var data = { relay_action: 'wplc_get_messages', security: wplc_nonce, chat_id: wplc_cid, limit:50, offset:0, received_via: 'u', wplc_extra_data:wplc_extra_data }; wplc_rest_api('get_messages', data, 12000, function(message_history) { if (typeof message_history.data !== "undefined" && typeof message_history.data.messages !== "undefined" && typeof message_history.data.messages === "object") { message_history = message_history.data.messages; for (var key in message_history) { var the_message = message_history[key]; the_message.mid = key; wplc_push_message_to_chatbox(the_message,'u', function() { wplc_scroll_to_bottom(); }); } } }); open_chat(1); jQuery.event.trigger({type: "wplc_open_chat_2", wplc_online: wplc_online}); }); /** * Sends the custom data packet via the socket if it exists */ jQuery(document).on("wplc_send_live_rating", function(e) { if(typeof e.rating !== "undefined"){ if(typeof socket !== "undefined" && typeof socket.emit !== "undefined"){ //We have a rating and a socket sprocket to send data with socket.emit('custom data',{action:'wplc_send_live_rating', chatid:wplc_cid, rating_data: e.rating}); } } }); /** * Edit message received from socket, edit in in the DOM * * PRO ONLY function * * @return void */ jQuery(document).on("bleeper_edit_message", function(e) { jQuery(".message_"+e.ndata.msgID+" .messageBody").html(wplcFormatParser(e.ndata.message) + " "+bleeper_localized_strings[4]+""); }); //Handler for edits jQuery(document).on("bleeper_edited_message", function(e){ if(typeof e.ndata !== "undefined"){ if(typeof e.ndata.message !== "undefined" && typeof e.ndata.chatid !== "undefined" && typeof e.ndata.msgID !== "undefined"){ var current_msg = e.ndata.message; var current_cid = e.ndata.chatid; var current_msg_id = e.ndata.msgID; var data = { chat_id: current_cid, message: current_msg, msg_id: current_msg_id }; wplc_rest_api('edit_message', data, 12000, null); } } }); /** * Sends minimize event via the socket if it exists */ jQuery(document).on("wplc_minimize_chat", function(e) { if(typeof socket !== "undefined" && typeof socket.emit !== "undefined"){ socket.emit('custom data',{action:'wplc_minimized', chatid:wplc_cid}); } }); /** * Send maximize event via socket if it exists */ jQuery(document).on("wplc_open_chat", function(e) { if(typeof socket !== "undefined" && typeof socket.emit !== "undefined"){ socket.emit('custom data',{action:'wplc_maximized', chatid:wplc_cid}); } }); jQuery(document).on("mouseleave",".wplc-user-message", function() { var tmid = jQuery(this).attr('mid'); jQuery(".message_"+tmid+ " .bleeper-edit-message").hide(); }); jQuery(document).on("mouseenter",".wplc-user-message", function() { var tmid = jQuery(this).attr('mid'); jQuery(".message_"+tmid+ " .bleeper-edit-message").show(); }); }); // source --> https://canbaby.ca/wp-content/plugins/wp-live-chat-support/js/wplc_u_editor.js?ver=5.2.20 jQuery(document).on("wplc_animation_done", function(e) { //Hide box originally //jQuery("#nifty_text_editor_holder").hide(); jQuery(function(){ /*jQuery("#wplc_chatmsg").focus(function(){ //Show editor Panel jQuery("#nifty_text_editor_holder").show(); jQuery("#wplc_msg_notice").hide(); }); jQuery("#wplc_chatmsg").focusout(function(){ //Hide editor Panel setTimeout(function(){ if(document.activeElement.id !== "wplc_chatmsg"){ jQuery("#nifty_text_editor_holder").hide(); jQuery("#wplc_msg_notice").show(); } },200); });*/ /*Text editor Support*/ jQuery("#nifty_tedit_b").click(function(evt){ evt.stopImmediatePropagation(); niftyTextEdit("b"); }); jQuery("#nifty_tedit_i").click(function(evt){ evt.stopImmediatePropagation(); niftyTextEdit("i"); }); jQuery("#nifty_tedit_u").click(function(evt){ evt.stopImmediatePropagation(); niftyTextEdit("u"); }); jQuery("#nifty_tedit_strike").click(function(evt){ evt.stopImmediatePropagation(); niftyTextEdit("strike"); }); jQuery("#nifty_tedit_mark").click(function(evt){ evt.stopImmediatePropagation(); niftyTextEdit("mark"); }); jQuery("#nifty_tedit_sub").click(function(evt){ evt.stopImmediatePropagation(); niftyTextEdit("sub"); }); jQuery("#nifty_tedit_sup").click(function(evt){ evt.stopImmediatePropagation(); niftyTextEdit("sup"); }); jQuery("#nifty_tedit_link").click(function(evt){ evt.stopImmediatePropagation(); niftyTextEdit("link"); }); }); }); if(typeof wplcFormatParser === "undefined"){ function wplcFormatParser(msg){ if(msg.indexOf("link:") !== -1){ msg = msg.replace(/link:/g, "Link"); } if(msg.indexOf("img:") !== -1){ msg = msg.replace(/img:/g, ""); } if(msg.indexOf("video:") !== -1){ msg = msg.replace(/video:/g, ""); } if(msg.indexOf("mark:") !== -1){ msg = msg.replace(/mark:/g, ""); } if(msg.indexOf(":mark") !== -1){ msg = msg.replace(/:mark/g, ""); } if(msg.indexOf("strike:") !== -1){ msg = msg.replace(/strike:/g, ""); } if(msg.indexOf(":strike") !== -1){ msg = msg.replace(/:strike/g, ""); } if(msg.indexOf("sub:") !== -1){ msg = msg.replace(/sub:/g, ""); } if(msg.indexOf(":sub") !== -1){ msg = msg.replace(/:sub/g, ""); } if(msg.indexOf("sup:") !== -1){ msg = msg.replace(/sup:/g, ""); } if(msg.indexOf(":sup") !== -1){ msg = msg.replace(/:sup/g, ""); } //run singles last if(msg.indexOf("b:") !== -1){ msg = msg.replace(/b:/g, ""); } if(msg.indexOf(":b") !== -1){ msg = msg.replace(/:b/g, ""); } if(msg.indexOf("i:") !== -1){ msg = msg.replace(/i:/g, ""); } if(msg.indexOf(":i") !== -1){ msg = msg.replace(/:i/g, ""); } if(msg.indexOf("u:") !== -1){ msg = msg.replace(/u:/g, ""); } if(msg.indexOf(":u") !== -1){ msg = msg.replace(/:u/g, ""); } return msg; } } var selectedIndexStart; var selectedIndexEnd; var checkSelection = true; function getText(elem) { if(checkSelection){ if(elem !== null && (elem.selectionStart !== null && typeof elem.selectionStart !== 'undefined')){ if(selectedIndexStart !== elem.selectionStart){ selectedIndexStart = elem.selectionStart; } } if(elem !== null && ( typeof elem.selectionEnd !== 'undefined' && elem.selectionEnd !== null)){ if(selectedIndexEnd !== elem.selectionEnd){ selectedIndexEnd = elem.selectionEnd; } } } } setInterval(function() { getText(document.getElementById("wplc_chatmsg")); }, 1000); function niftyTextEdit(insertContent){ checkSelection = false; /*Text editor Code here*/ jQuery("#wplc_chatmsg").focus(); var current = jQuery("#wplc_chatmsg").val(); var pre = current.substr(0, (selectedIndexStart > 0) ? selectedIndexStart : 0); var selection = current.substr(selectedIndexStart, selectedIndexEnd - selectedIndexStart); var post = current.substr(((selectedIndexEnd < current.length) ? selectedIndexEnd : current.length ), current.length); current = pre + insertContent + ":" + selection + ":" + insertContent + post; jQuery("#wplc_chatmsg").val(current); checkSelection = true; };